/* Gauge - Performance Measurement Framework for Mobile Platforms
 * Copyright (C) 2013, Juha Hytonen <juha.a.hytonen@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.gauge;

import org.gauge.AbstractConnectionManager.ConnectionManagerCb;

import android.content.Context;

/**
 * Benchmark controller executes all benchmark registered in the
 * benchmark factory.
 * 
 * @see Benchmark
 * @see org.gauge.GaugeAgent.BenchmarkFactory
 */
public interface BenchmarkController {

	/**
	 * Benchmark controller callback. Provides status information of
	 * benchmark execution.
	 */
    public interface BenchmarkControllerCb {

    	/**
    	 * Started executing benchmarks.
    	 */
    	public void RunningBenchmarksEvent();

    	/**
    	 * Executing benchmark with given name.
    	 * 
    	 * @see Benchmark.GetName()
    	 */
    	public void RunningBenchmarkEvent(String name);
    	
    	/**
    	 * Finished executing benchmarks.
    	 */
    	public void StoppedEvent();

    }

    /**
     * Sets callbacks for BenchmarkController and ConnectionManager.
     * Callbacks are mainly used for user interfaces.
     */
    public void SetCallbacks(BenchmarkControllerCb ctrlCb, ConnectionManagerCb connmanCb);
    
    /**
     * Connects to server at given address and port.
     */
    public void ConnectToServer(String ipAddress, int port);
    
    /**
     * Disconnects from server.
     */
    public void DisconnectFromServer();
    
    /**
     * Execute all benchmarks registered with the benchmark factory.
     * 
     * @see org.gauge.GaugeAgent.BenchmarkFactory
     */
    public void RunBenchmarks();

    /**
     * @see Benchmark.readProbe
     */
    public void ReadProbe(Class<? extends Probe> probeClass);

    /**
     * @see Benchmark.readProbeEvery
     */
    public void ReadProbeEvery(Class<? extends Probe> probeClass, int millisecs);

    /**
     * @see Benchmark.runWorkload
     */
    public void RunWorkload(Class<? extends Workload> workloadClass);

    /**
     * @see Benchmark.runWorkloadFor
     */
    public void RunWorkloadFor(Class<? extends Workload> workloadClass, int millisecs);

    /**
     * @see Benchmark.runWorkloadEvery
     */
    public void RunWorkloadEvery(Class<? extends Workload> workloadClass, int millisecs);

    /**
     * @see Benchmark.beforeNextActionWaitFor
     */
    public void BeforeNextActionWaitFor(int millisecs);

    /**
     * @see Benchmark.waitForBackgroundWorkloadToStop
     */
    public void WaitForWorkloadToStop(Class<? extends Workload> workloadClass);
    
    /**
     * @see Benchmark.stopRunningWorkload
     */
    public void StopRunningWorkload(Class<? extends Workload> workloadClass);
 
}
